package com.tedu.pj.goods.service;

import com.tedu.pj.goods.dao.GoodsDao;
import com.tedu.pj.goods.pojo.Goods;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class GoodsServiceImpl implements GoodsService{
    private static final Logger log= LoggerFactory.getLogger(GoodsServiceImpl.class);
    @Autowired
    GoodsDao goodsDao;

    @Override
    public int updateGoods(Goods goods) {
        return goodsDao.updateGoods(goods);
    }

    @Override
    public Goods findByIdGoods(int id) {
        return goodsDao.findByIdGoods(id);
    }

    @Override
    public int removeByIdGoods(int id) {
        return goodsDao.removeByIdGoods(id);
    }

    @Override
    public void insertGoods(Goods goods) {
        goodsDao.insertGoods(goods);
    }

    @Override
    public List<Goods> findGoods() {
        long start=System.currentTimeMillis();
        List<Goods> list= goodsDao.findGoods();
        long end=System.currentTimeMillis();
        log.info("findGoods time-> {}",end-start);
        return list;
    }
}
